<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAgricGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('agric_goods', function (Blueprint $table) {
            $table->increments('id')->comment('农业商品表');
            $table->string('goods_name', 255)->nullable()->comment('商品名称');
            $table->string('goods_img', 255)->nullable()->comment('商品主图');
            $table->text('slider_img')->nullable()->comment('商品轮播图');
            $table->decimal('goods_price', 8, 2)->nullable()->comment('商品价格')->default(0.00);
            $table->decimal('acticity_price', 8, 2)->nullable()->comment('活动价格')->default(0.00);
            $table->string('goods_unit', 32)->nullable()->comment('商品购买单位（/天/周/月）');
            $table->string('goods_place', 255)->nullable()->comment('商品发货地点');
            $table->integer('interested_num')->nullable()->comment('感兴趣人数')->default(0);
            $table->integer('sales_num')->nullable()->comment('销售总数')->default(0);
            $table ->integer('hit_num')->nullable()->default('0')->comment('点击数');
            $table->tinyInteger('is_show')->nullable()->comment('上架状态')->default(0);
            $table->integer('region_id')->nullable()->comment('所属地区ID（1.北洸村）')->default(0);
            $table->integer('seller_id')->nullable()->comment('卖家ID')->default(0);
            $table->integer('category_id')->nullable()->comment('商品分类ID');
            $table->tinyInteger('is_top')->nullable()->comment('置顶')->default(0);
            $table->integer('sort')->nullable()->comment('排序');
            $table->text('goods_label')->nullable()->comment('商品标签json');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('agric_goods');
    }
}
